package com.richeyward.calculator;

import android.content.Context;
import android.graphics.Color;
import android.graphics.PorterDuff.Mode;
import android.widget.Button;
import android.widget.LinearLayout.LayoutParams;

public class calcButton {
	public static Button createButton(Context c, int i) {
		LayoutParams buttonParams = new LayoutParams(LayoutParams.MATCH_PARENT,LayoutParams.MATCH_PARENT);
		buttonParams.weight=25;
		buttonParams.setMargins(-3, -4, -3, -4);
		String[] buttonLabels = {"0","1","2","3","4","5","6","7","8","9","+","-","×","÷",".","="};
		Button b = new Button(c);
		b.setText(buttonLabels[i]);
		b.setTextColor(Color.WHITE);
		b.setTextSize(40);
		if (i < 10) { 
			b.getBackground().setColorFilter(Color.DKGRAY, Mode.MULTIPLY);
		} else {
			b.getBackground().setColorFilter(Color.rgb(30, 30, 30), Mode.MULTIPLY);
		}
		b.setLayoutParams(buttonParams);
		return b;
	}
}
